<?php
class Line_reviews_reply_model extends CI_Model
{
    private $table = 'line_reviews_reply';
    
    public function findByReviewId($review_id)
    {
        $this->db->where('review_id', $review_id);
        return $this->db->get($this->table);
    }

    public function insertLineReviewsReplySupply($postData)
    {
        $data = array(
            'review_id'      => $postData['review_id'],
            'reply_content'  => $postData['reply_content']
        );
        if ($this->session->userdata('ACT_UID')) {
            $data['reply_user_name'] = $this->session->userdata('OWNER_NAME');
        }
        $this->db->insert($this->table, $data);
        return $this->db->insert_id();
    }
    
    public function deleteById($id)
    {
        $this->db->where('id', $id);
        return $this->db->delete($this->table);
    }
}